package pro.spring.controller.backController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


@Controller
@RequestMapping("/admin")
public class MainController extends BaseController{
	
	@RequestMapping(value="index",method=RequestMethod.GET)
	public String index(HttpServletRequest request,
			HttpServletResponse response,ModelMap map){
		HttpSession session=request.getSession();
		Integer aId = (Integer)session.getAttribute("aId");
		map.put("admin",adminService.selectByPrimaryKey(aId));
		return "page/back/index/index";
	}
	
	@RequestMapping(value="f_index",method=RequestMethod.GET)
	public String f_index(){
		return "page/back/index/f_index";
	}
	
	@RequestMapping(value="out.html",method=RequestMethod.GET)
	public String out(HttpServletRequest request,
			HttpServletResponse response){
		HttpSession session=request.getSession();
		session.setAttribute("aId",null);
		return "redirect:index.html";
	}
	
	
}
